<?xml version="1.0"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0" xmlns:hr="http://eric.van-der-vlist.com/ns/person" xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns:sn="http://www.snee.com/ns/stages" ns="http://eric.van-der-vlist.com/ns/library">
  <start>
    <choice>
      <element name="library">
        <oneOrMore>
          <ref name="book-element"/>
        </oneOrMore>
      </element>
      <ref name="book-element"/>
      <ref name="author-element"/>
      <ref name="character-element"/>
    </choice>
  </start>
  <include href="foreign.rng">
    <define name="foreign-elements">
      <zeroOrMore>
        <element>
          <anyName>
            <except>
              <nsName ns=""/>
              <nsName ns="http://eric.van-der-vlist.com/ns/library"/>
              <nsName ns="http://eric.van-der-vlist.com/ns/person"/>
            </except>
          </anyName>
          <ref name="anything"/>
        </element>
      </zeroOrMore>
    </define>
    <define name="foreign-attributes">
      <zeroOrMore>
        <attribute>
          <anyName>
            <except>
              <nsName ns=""/>
              <nsName ns="http://eric.van-der-vlist.com/ns/library"/>
              <nsName ns="http://eric.van-der-vlist.com/ns/person"/>
            </except>
          </anyName>
        </attribute>
      </zeroOrMore>
    </define>
  </include>
  <define name="author-element">
    <element name="hr:author">
      <attribute name="id">
        <data datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" type="NMTOKEN">
          <param name="maxLength"> 16 </param>
        </data>
      </attribute>
      <ref name="name-element"/>
      <ref name="born-element"/>
      <optional>
        <ref name="dead-element"/>
      </optional>
    </element>
  </define>
  <include href="book-content.rng" ns="http://eric.van-der-vlist.com/ns/library"/>
  <define name="book-content" combine="interleave">
    <ref name="foreign-nodes"/>
  </define>
  <define name="book-element">
    <element name="book">
      <ref name="book-content"/>
    </element>
  </define>
  <define name="born-element">
    <element>
      <name>hr:born</name>
      <data datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" type="date"/>
    </element>
  </define>
  <define name="character-element">
    <externalRef href="character-element.rng" ns="http://eric.van-der-vlist.com/ns/library"/>
  </define>
  <define name="dead-element">
    <element name="hr:dead">
      <data datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" type="date"/>
    </element>
  </define>
  <define name="isbn-element">
    <element name="isbn">
      <ref name="foreign-attributes"/>
      <data datatypeLibrary="" type="token"/>
    </element>
  </define>
  <define name="name-element">
    <element name="hr:name">
      <data datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" type="token"/>
    </element>
  </define>
  <define name="qualification-element">
    <element name="qualification">
      <text/>
    </element>
  </define>
  <define name="title-element">
    <element name="title">
      <ref name="foreign-attributes"/>
      <text/>
    </element>
  </define>
  <define name="available-content">
    <choice>
      <value type="token" datatypeLibrary="">true</value>
      <value datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" type="token"> false </value>
      <value type="token" datatypeLibrary=""> </value>
    </choice>
  </define>
</grammar>
